/*
 * 轮播图列表
 * @Author: LuoQianJun 
 * @Date: 2018-01-26 11:30:37
 * @Last Modified by: LuoQianJun
 * @Last Modified time: 2018-01-30 10:07:09
 */
<style lang="less" rel="stylesheet/less" type="text/less" scoped>

</style>
<template>
<div class="v-admin-carousel-index">

    <Table border :columns="columns" :loading="loading" :data="banners"></Table>

</div>
</template>

<script>

import Button from 'iview/src/components/button';

export default {

    name: 'carousel-index',

    props: ['loading','banners'],

    data() {	

        return {

            columns: [

                {
                    title: '图片',
                    key: 'image',
                    align: 'center',
                    render: (h,{row}) => {
                        return <div> { row.image
                                        ? <img src={ row.image} alt="无" width="50%" height="50%"/>
                                        : '无' } </div>
                    }
                },
                             
                {
                    title: '优先级',
                    key: 'priority',
                    align: 'center',
                    render: (h,{row}) => {
                        return <div> { row.priority || 0 } </div>
                    }
                },

                {
                    title: '创建时间',
                    key: 'created_at',
                    align: 'center',
                    render: (h,{row}) => {
                        return <div> { row.created_at || '-' } </div>
                    }
                },

                {
                    title: '更新时间',
                    key: 'updated_at',
                    align: 'center',
                    render: (h,{row}) => {
                        return <div> { row.updated_at || '-' } </div>
                    }
                },
               
                {
                    title: '操作',
                    align: 'center',
                    width: 200,
                    render: (h, {row}) => {
                        return (
                            <div>
                                <Button size="small" style={{ marginRight: '5px' }} on-click={() => {this.$emit('edit',row.id)}}  type="primary">修改</Button>
                                <Button size="small" style={{ marginRight: '5px' }} type="error" on-click={() => {this.$emit('delete',row.id)}}>删除</Button>
                                <Button size="small" type="success" on-click={() => {this.$emit('watch',row.id)}}>查看大图</Button>
                            </div>)
                    }
                }
            ]
        }
    },
    
}
</script>